﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharedGenomics.Workbench.Core
{
    public class TaskRegistry : ITaskRegistry
    {
        private Dictionary<string, ITask> _tasks;

        public TaskRegistry()
        {
            this._tasks = new Dictionary<string, ITask>();
        }

        public void AddTask(ITask task)
        {
            this._tasks.Add(task.Name, task);
        }

        public ITask this[string taskName]
        {
            get { return this._tasks[taskName]; }
        }

        #region IEnumerable<ITask> Members

        public IEnumerator<ITask> GetEnumerator()
        {
            return this._tasks.Values.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.GetEnumerator();
        }

        #endregion
    }
}
